/*package com.ad2campaign.engine.core.schedulers;

import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.batch.core.configuration.JobLocator;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.launch.JobOperator;
import org.springframework.web.client.RestTemplate;

import com.ad2campaign.engine.db.dao.PushNotificationMasterDao;
import com.ad2campaign.engine.db.model.PushNotificationMaster;
import com.ad2campaign.engine.utils.JobUtils;
import com.ad2campaign.engine.utils.Node;
import com.ad2campaign.engine.utils.ParamUtils;

public class JobScheduler {
	private static final Logger LOGGER = Logger.getLogger(JobScheduler.class);
 	private String sql;
	private long interval = 1000l;//default 1 second
	private PushNotificationMasterDao pushNotificationMasterDao;
	private volatile boolean isMaster;
 	private String jobName;
	private JobLocator jobLocator;
	private JobOperator jobOperator;
 	private JobExplorer jobExplorer;
 	private JobLauncher jobLauncher;
	private String classIOS;
	private String classAndroid;
 	private List<Node> nodes;
 	private RestTemplate restTemplate;
	 
	public void runScheduler()
	{
   		while(isMaster)
 		{
 			try 
 			{
				List<PushNotificationMaster> resultList = pushNotificationMasterDao.findPushByDate(new Date());
				LOGGER.info("JobScheduler.runScheduler():  Got ["+resultList.size()+"] new message(s) to process");
  				if (resultList!=null)
 				{	
				for(PushNotificationMaster pnm:resultList)
				{
 					LOGGER.info("JobScheduler.runScheduler():  Picked message of ID "+pnm.getId());
					if (LOGGER.isDebugEnabled())
					{
						LOGGER.debug("JobScheduler.runScheduler(): Processing message ["+pnm.toString()+"]");
					}
					String parameter = ParamUtils.getParameter(pnm,classIOS,classAndroid);
			 		JobUtils.allocateJob(jobName, parameter, restTemplate, nodes);
			 		pushNotificationMasterDao.setJobStatusById(pnm.getId(),1);
					LOGGER.info("JobScheduler.runScheduler():  Completed processing of message of ID ["+pnm.getId()+"]");
  				}
 				}
			} 
			catch (Exception e) 
			{
				LOGGER.info("Exception while job execution:",e);
			}
			try
			{
				Thread.sleep(interval);
 			}
			catch(Exception e)
			{
				LOGGER.info("Exception in scheduler:",e);
			}
		}
   }

 


	The shutdown for the engine
	public void stopAllRunningJob()
	{
		JobUtils.stopAllRunningJob(jobOperator,jobName);
 	}
 
	*//************************************************GETTER AND SETTER*************************************//*
	public String getSql() {
		return sql;
	}
	public void setSql(String sql) {
		this.sql = sql;
	}

	public long getInterval() {
		return interval;
	}
	public void setInterval(long interval) {
		this.interval = interval;
	}

  	public String getJobName() {
		return jobName;
	}
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public JobLocator getJobLocator() {
		return jobLocator;
	}
	public void setJobLocator(JobLocator jobLocator) {
		this.jobLocator = jobLocator;
	}

	public JobLauncher getJobLauncher() {
		return jobLauncher;
	}
	public void setJobLauncher(JobLauncher jobLauncher) {
		this.jobLauncher = jobLauncher;
	}


	public String getClassIOS() {
		return classIOS;
	}


	public void setClassIOS(String classIOS) {
		this.classIOS = classIOS;
	}


	public String getClassAndroid() {
		return classAndroid;
	}


	public void setClassAndroid(String classAndroid) {
		this.classAndroid = classAndroid;
	}

	public PushNotificationMasterDao getPushNotificationMasterDao() {
		return pushNotificationMasterDao;
	}


	public void setPushNotificationMasterDao(
			PushNotificationMasterDao pushNotificationMasterDao) {
		this.pushNotificationMasterDao = pushNotificationMasterDao;
	}

	public boolean isMaster() {
		return isMaster;
	}

	public JobOperator getJobOperator() {
		return jobOperator;
	}


	public void setJobOperator(JobOperator jobOperator) {
		this.jobOperator = jobOperator;
	}


	public void setMaster(boolean isMaster) {
		this.isMaster = isMaster;
	}
	
 	public JobExplorer getJobExplorer() {
		return jobExplorer;
	}


	public void setJobExplorer(JobExplorer jobExplorer) {
		this.jobExplorer = jobExplorer;
	}

	public List<Node> getNodes() {
		return nodes;
	}

 	public void setNodes(List<Node> nodes) {
		this.nodes = nodes;
	}

	public RestTemplate getRestTemplate() {
		return restTemplate;
	}



	public void setRestTemplate(RestTemplate restTemplate) {
		this.restTemplate = restTemplate;
	}



}
*/